package dome1;

import java.util.Scanner;

public class text2 {
    public static void main(String[] args){
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你要查找得字符串");
        String str1= scanner.nextLine();
        int index=str1.lastIndexOf(" ");//从后往前数查找要查找字符的位置
        int len=str1.substring(index+1).length();//从要找位置的开始遍历字符串求出该字符串长度；
        System.out.println(len);

    }






    public static void main1(String[] args){
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入您要求的字符串最后一个单词的长度");
        String str1= scanner.nextLine();
        String[] str2=str1.split(" ");
        int len= str2[str2.length-1].length();
        System.out.println(len);
    }
}
